// 销售单相关接口
import fetch from '@/config/fetch'

// 获取销售单列表
export const getOrderList = data => fetch('/sale_order/sale_order_list/', data);
// 查看销售单详情
export const infoOrder = (id, data) => fetch("/sale_order/"+ id +"/sale_order_single/", data);
// 新增销售单
export const addOrder = data => fetch('/sale_order/sale_order_add/', data, 'POST');
// 编辑销售单
export const updateOrder = (id, data) => fetch('/sale_order/'+id+'/sale_order_update/', data, 'PUT');
// 删除销售单
export const deleteOrder = (id, data) => fetch('/sale_order/'+id+'/sale_order_del/', data, 'DELETE');
// 批量删除销售单
export const deleteBatchOrder = data => fetch('/sale_order/sale_order_batch_del/', data, 'POST');

// 查询订单设置
export const getOrderSet = data => fetch('/set_order/set_order_list/', data);
// 订单字段设置
export const setOrderField = data => fetch('/set_order/set_order_add/', data, 'POST');
// 订单字段更新
export const updateOrderField = data => fetch('/set_order/set_order_update/', data, 'POST');
// 获取销售单编码
export const getOrderNo = data => fetch('/sale_order/sale_order_order_no/', data);
// 获取销售退单编码
export const getReturnOrderNo = data => fetch('/sale_return/sale_order_order_no/', data);

// 获取销售退单列表
export const listSaleReturns = data => fetch('/sale_return/sale_return_list/', data);
// 查看销售退单详情
export const infoSaleReturns = (id, data) => fetch("/sale_return/"+ id +"/sale_return_single/", data);
// 新增销售退单
export const addSaleReturns = data => fetch('/sale_return/sale_return_add/', data, 'POST');
// 编辑销售退单
export const editSaleReturns = (id, data) => fetch("/sale_return/"+ id +"/sale_return_update/", data, 'PUT');
// 删除销售退单
export const removeSaleReturns = (id, data) => fetch("/sale_return/"+ id +"/sale_return_del/", data, 'DELETE');
// 批量删除销售退单
export const removeBatchSaleReturns = data => fetch('/sale_return/sale_return_batch_del/', data, 'POST');

// 获取销售预定列表
export const getSaleReserveList = data => fetch('/reserve_order/order_list/', data);
// 查看销售预定详情
export const getSaleReserveInfo = (id, data) => fetch("/reserve_order/"+ id +"/order_single/", data);
// 新增销售预定
export const addSaleReserve = data => fetch('/reserve_order/order_add/', data, 'POST');
// 编辑销售预定
export const editSaleReserve = (id, data) => fetch("/reserve_order/"+ id +"/order_update/", data, 'PUT');
// 取消销售预定
export const cancelSaleReserve = (id, data) => fetch("/reserve_order/"+ id +"/order_cancel/", data, 'POST');
// 删除销售预定
export const removeSaleReserve = (id, data) => fetch("/reserve_order/"+ id +"/order_del/", data, 'DELETE');
// 批量删除销售预定
export const removeBatchSaleReserve = data => fetch('/reserve_order/order_batch_del/', data, 'POST');
// 保质期查询
export const getProductDate = data => fetch('/batch_date_account/query_batch_sell_by_date/', data);

// 批量添加发票
export const addInvoices = data => fetch('/sale_order/order_add_invoice/', data, 'POST');
// 批量作废发票
export const removeInvoices = data => fetch('/sale_order/order_remove_invoice/', data, 'POST');
// 批量发货
export const postDelivery = data => fetch('/sale_order/order_send_delivery/', data, 'POST');